#include <iostream>
#include <poll.h>
#define FDSIZE 4096
class PollServer
{
public:
    //完成初始化，打开套接字，端口绑定，打开监听...
    void Start()
    {
        while(true)
        {
            int n = poll(&_fds, FDSIZE, 0);
            //3.处理select返回值
            switch(n)
            {
            case -1:
                std::cout<<"select fail"<<std::endl;
                break;
            case 0:
                std::cout<<"time out..."<<std::endl;
            default:
                std::cout<<"事件就绪..."<<std::endl;
                //处理事件
                HandlerEvent();
                //......
            }

        }
    }
    //......
private:
    int _listenfd;
    struct pollfd _fds[FDSIZE];
    //......
};


void Start()
{
    while(true)
    {
        int n = poll(&_fds, FDSIZE, 0);
        //处理poll返回值
        switch(n)
        {
        case -1:
            std::cout<<"select fail"<<std::endl;
            break;
        case 0:
            std::cout<<"time out..."<<std::endl;
        default:
            std::cout<<"事件就绪..."<<std::endl;
            //处理事件
            HandlerEvent();
            //......
        }
    }
}